#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
int p[N], phi[N], cnt;
bool st[N];
long long ans;
int n;
void solve() {
  phi[1] = 1;
  for (int i = 2; i <= n; ++i) {
    if (!st[i]) {
      p[cnt++] = i;
      phi[i] = i - 1;
    }
    for (int j = 0; p[j] <= n / i; ++j) {
      st[i * p[j]] = true;
      if (i % p[j] == 0) {
        phi[i * p[j]] = phi[i] * p[j];
        break;
      }
      phi[i * p[j]] = phi[i] * (p[j] - 1);
    }
  }
}
int main() {
  cin >> n;
  solve();
  for (int i = 1; i <= n; ++i) {
    // cout << phi[i] << ' ';
    ans += phi[i];
  }
  cout << ans << endl;
  return 0;
}
